import Vue from 'vue'
import VueRouter from 'vue-router'
import Layout from '@/Layout'

Vue.use(VueRouter)
const routes = [
  {
    path: '/',
    component: Layout,
    redirect: '/dashboard',
    children: [{
      path: '/dashboard',
      name: 'dashboard',
      component: () => import('@/views/Dashboard')
    },
      {
        path: '/site-set',
        name: 'site-set',
        component: () => import('@/views/SiteSet')
      }
    ]
  },
  {
    path: '/',
    component: Layout,
    children: [
      {
        path: '/content',
        component: () => import('@/views/Container'),
        redirect: '/content/list',
        children: [
          {
            path: 'list',
            component: () => import('@/views/content/article/List')
          },
          {
            path: 'write',
            name: 'Write',
            component: () => import('@/views/content/article/Write')
          },
          {
            path: 'leave-msg',
            name: 'LeaveMsg',
            component: () => import('@/views/content/article/LeaveMsg')
          },
          {
            path: 'dustbin',
            name: 'Dustbin',
            component: () => import('@/views/content/article/Dustbin')
          },
          {
            path: 'page-new',
            name: 'page-new',
            component: () => import('@/views/content/page/New')
          },
          {
            path: 'page-list',
            name: 'page-list',
            component: () => import('@/views/content/page/List')
          }
        ]
      }
    ]
  },
  {
    path: '/login',
    name: 'Login',
    component: () => import('@/views/Login')
  },
  {
    path: '*',
    component: Layout,
    redirect: '/E404',
    children: [
      {
        path: '/E404',
        name: 'E404',
        component: () => import('@/views/E404')
      }
    ]
  }
]
const router = new VueRouter({
  routes
})
export default router
